<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<%@taglib prefix="sj" uri="/struts-jquery-tags"%>
<%@taglib prefix="sjg" uri="/struts-jquery-grid-tags"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<html>
<head>
<sj:head jqueryui="true" jquerytheme="redmond"></sj:head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Organisation List Page</title>
<script type="text/javascript">
	$.subscribe('rowselect', function(event, data) {
	var grid = event.originalEvent.grid;
	var sel_id = grid.jqGrid('getGridParam', 'selrow');
	var isActive = grid.jqGrid('getCell', sel_id, 'status');	
	if(isActive =='false'){
	var r= confirm("Do you want to make this Organisation active?");	
	if(r==true){
		window.location = "vUpdateOrganisation.action";
		}
	else{
		
		}
	}
	else{
		window.location = "vAmendOrganisation.action";
		}
	});  
	function onClickCreate(){
		window.location = "vCreatOrganisation.action";
	}
	function onClickInclude(){
		window.location = "vIncludeOrganisation.action";
		}
	
</script>
</head>
<body>

	<s:form action="detailAction" theme="simple">
		<tr>
			<td><a href="<s:url action="vOrganisationAllSearch"/>">All</a></td>
			<td><a href="<s:url action="vOrganisation09Search"/>">0-9</a></td>
			<td><a href="<s:url action="vOrganisationAESearch"/>">A B C D E</a></td>
			<td><a href="<s:url action="vOrganisationFJSearch"/>">F G H I J</a></td>
			<td><a href="<s:url action="vOrganisationKNSearch"/>">K L M N</a></td>
			<td><a href="<s:url action="vOrganisationORSearch"/>">O P Q R</a></td>
			<td><a href="<s:url action="vOrganisationSVSearch"/>">S T U V</a></td>
			<td><a href="<s:url action="vOrganisationWZSearch"/>">W X Y Z</a></td>
			<td> <sj:a button="true" onclick="onClickCreate()" >Create</sj:a> </td>
			<td><s:checkbox name="includeInactive" onclick="onClickInclude()"> Include In-active </s:checkbox>
			</td>
		</tr>
		<br>
		<s:url id="remoteurl" action="vOrganisationNtable" />

		<sjg:grid id="gridtable" caption="Organsation" dataType="json"
			href="%{remoteurl}"  gridModel="gridModel"
			rowList="10,15,20" rowNum="15" editurl="%{editurl}" navigator="false"
			pager="true"
			rownumbers="true"
			onSelectRowTopics="rowselect">
			<sjg:gridColumn name="orgName" index="orgName" title="Organisation Name"
				sortable="true" />
			<sjg:gridColumn name="addressLine1" index="addressLine1" title="Head Office"
				sortable="true" />
			<sjg:gridColumn name="postCode" index="postCode" title="Post Code"
				sortable="false" />
			<sjg:gridColumn name="contactId" index="contactId" title="Contact"
				sortable="false" />
			<sjg:gridColumn name="status" index="status" title="Is Active"
				sortable="false" />
		</sjg:grid>

	</s:form>
	
</body>
</html>
